package com.sky.mapper.user;

import com.sky.pojo.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description ShoppingCartMapper
 * @Author lyh
 * @Date 2024-10-07
 */
@Mapper
public interface ShoppingCartMapper {
    /**
     * 根据条件查询购物车
     * @param dto
     * @return
     */
    List<ShoppingCart> queryByContional(ShoppingCart dto);

    /**
     * 添加购物车菜品数量
     * @param id
     */
    void addCartNumberById(Long id);

    /**
     * 添加购物车
     * @param shoppingCart
     */
    void addCart(ShoppingCart shoppingCart);

    /**
     * 根据当前用户获取购物车
     * @param userId
     * @return
     */
    List<ShoppingCart> getShoppingCartListByUserId(Long userId);

    /**
     * 根据当前用户清空购物车
     * @param userId
     */
    @Delete("delete from shopping_cart where user_id=#{userId}")
    void cleanCartByUserId(Long userId);


    Integer getMakeTime(Long userId);

    void addCartBatch(@Param("list") List<ShoppingCart> list);
}
